package com.example.expandablelistview.thread;

import android.app.Activity;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.view.View;
import android.widget.TextView;

import com.example.expandablelistview.R;

public class LongTime2 extends Activity {
	int mValue;
	TextView mText;

	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.longtime);
		mText = (TextView) findViewById(R.id.text);
	}

	public void mOnClick(View v) {
		mValue = 0;
		mHandler.sendEmptyMessage(0);
	}

	Handler mHandler = new Handler() {
		public void handleMessage(Message msg) {
			mValue++;
			mText.setText(Integer.toString(mValue));
			try {
				Thread.sleep(50);
			} catch (InterruptedException e) {
				;
			}
			if (mValue < 100) {
				mHandler.sendEmptyMessage(0);
			}
		}
	};
}
